<?php
namespace app\before\validate;

use think\Validate;

class Service extends Validate
{
    protected $rule = [
        'type' => 'require',
        'user_id' => 'require|number',
        'tag' => 'require',
        'title' => 'require',
        'suffer' => 'require',
        'remark' => 'require',
        'pay_price' => 'require|number',
        'price' => 'require|number',
        'service_type' => 'require',
        'service_time' => 'require',
        'pay_type' => 'require',
        'tel' => 'require',
        'hint' => 'require',
        'complain' => 'require|number',
        'status' => 'require',
        'add_time' => 'require|number',
    ];
    protected $message = [
        'type.require' => '服务类型 1：有偿  2：无偿为必填项',
        'user_id.require' => '发布人ID为必填项',
        'user_id.number' => '发布人ID需为数字',
        'tag.require' => '标签为必填项',
        'title.require' => '服务内容为必填项',
        'suffer.require' => '服务经验为必填项',
        'remark.require' => '注意事项为必填项',
        'pay_price.require' => '定金为必填项',
        'pay_price.number' => '定金需为数字',
        'price.require' => '价格为必填项',
        'price.number' => '价格需为数字',
        'service_type.require' => '服务方式   1:线上  2：线下为必填项',
        'service_time.require' => '服务时间为必填项',
        'pay_type.require' => '收费方式为必填项',
        'tel.require' => '联系电话为必填项',
        'hint.require' => '下单提示 0：否 1：是为必填项',
        'complain.require' => '投诉次数为必填项',
        'complain.number' => '投诉次数需为数字',
        'status.require' => '状态 1：正常 0：删除为必填项',
        'add_time.require' => 'add_time为必填项',
        'add_time.number' => 'add_time需为数字',
    ];
    protected $scene = [
        'edit' => [
            'type',
            'user_id',
            'tag',
            'title',
            'suffer',
            'remark',
            'pay_price',
            'price',
            'service_type',
            'service_time',
            'pay_type',
            'tel',
            'hint',
            'complain',
            'status',
            'add_time',
        ],
    ];
}
